﻿using System.Collections.Generic;
using BestCode.Creds.Data.MapHelper;
using BestCode.Creds.Entities;
using NHibernate.Criterion;

namespace BestCode.Creds.Data
{
    public class EntityChildDao : DaoBase<EntityChild>, IEntityChildDao
    {
        public IList<EntityChild> GetByFilter(string filter)
        {
            return Session.QueryOver<EntityChild>().Where(p => p.Name.IsLike(filter + "%")).List();
        }

        public IList<EntityChild> GetByEntityId(int entityId)
        {
            return Session.QueryOver<EntityChild>().Where(p => p.Entity.Id == entityId).List();
        }

    }
}
